package com.xhq.wms.controller.system;

import com.sun.deploy.net.HttpRequest;
import com.xhq.commons.dto.Pageable;
import com.xhq.webmvc.annotation.RequestBean;
import com.xhq.webmvc.annotation.RequestMapping;
import com.xhq.webmvc.annotation.ResponseJson;
import com.xhq.webmvc.model.JSONResponse;
import com.xhq.wms.entity.system.Plan;
import com.xhq.wms.service.system.impl.PlanServiceImpl;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;

@WebServlet
@RequestMapping("/receive")
public class ReceiveBillController {
    PlanServiceImpl planService =new PlanServiceImpl();
    @RequestMapping("/center")
  public String center() {
      return "center";
  }
    @RequestMapping("/process")
    public String process() {
        return "process";
    }

    @RequestMapping("/plan")
    public String plan() {
        return "plan";
    }

    @RequestMapping("/list")
    @ResponseJson
    public Pageable<Plan> list(Integer offset,Integer limit) {
        Pageable<Plan> list = planService.list(offset, limit);
        return list;
    }

    @RequestMapping("/plan/add")
    public String planAdd() {
        return "/plan/add";
    }
    @RequestMapping("/plan/save")
    public String save(@RequestBean Plan plan) {
       planService.save(plan);
       return "redirect:/receive/plan";
    }

    @RequestMapping("/plan/delete")
    @ResponseJson
    public JSONResponse delete(String ids){
        planService.deleteBatch(ids);
        return JSONResponse.success("删除成功");
    }

    @RequestMapping("/plan/edit")
    public String save(Integer id, HttpServletRequest request) {
        Plan plan = planService.find(id);

        return "/plan/edit";
    }


}
